package com.pj.wisdomlogistics.rx;


import com.pj.wisdomlogistics.ApiException;
import com.pj.wisdomlogistics.entity.response.BaseResponse;

import rx.functions.Func1;

public class ResultFilter<T> implements Func1<BaseResponse<T>, T> {
    @Override
    public T call(BaseResponse<T> response) {
        if (response.getCode() != 1) {
            throw new ApiException(response.getCode(), response.getMsg());
        }
        return response.getBody();
    }
}